package whisper.common.utils;

import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;

/**
 * Created by JT on 2017/12/10.
 */
public class EncodeUtils {

    public static String hex(String... strs) {
        StringBuilder strBuilder = new StringBuilder();
        for (String str : strs) {
            strBuilder.append(str);
        }
        return Hex.encodeHexString(strBuilder.toString().getBytes());
    }

    /**
     * MD5 加密
     * @param strArray
     * @return
     */
    public static String encodeMD5(String... strArray) {
        StringBuilder stringBuilder = new StringBuilder();
        for (String str : strArray) {
            stringBuilder.append(str);
        }
        return DigestUtils.md5Hex(stringBuilder.toString());
    }
}
